package com.qf.hospital.service.impl;

import com.qf.hospital.constants.HospitalConstants;
import com.qf.hospital.entity.RegisterExample;
import com.qf.hospital.mapper.RegisterMapper;
import com.qf.hospital.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author 何星宇
 * @version V1.0
 * @Date 2021/10/19 21:16
 */

@Service
public class RegisterServiceImpl implements RegisterService {
    @Autowired
    private RegisterMapper mapper;

    /**
     * 查询住院总人数
     * @return
     */
    @Override
    public Integer findRegisterTotal() {
        RegisterExample example = new RegisterExample();
        example.createCriteria().andStateNotEqualTo(HospitalConstants.DELETE);
        long count = mapper.countByExample(example);
        return Integer.valueOf(count+"");
    }

    /**
     * 查询今日住院总人数
     * @return
     */
    @Override
    public Integer findRegisterCurrent() {
        long count = mapper.findRegisterByCurrent();
        return Integer.valueOf(count+"");
    }
}
